package com.qingke;

import com.qingke.command.Command;
import com.qingke.command.CommandFactory;
import com.qingke.command.CommandFactory.CommandCode;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args )
    {
    	QingkeConsole.println("you can use the \"HELP\" for command usage Have fun");
		while (true) {
			String cmd = QingkeConsole.askUserInput("cmd");
			CommandCode cmdCode = null;
			try {
				cmdCode = CommandCode.valueOf(cmd.toUpperCase());
			} catch (Exception e) {
				QingkeConsole.println("你输入了不合法的命令，请使用 HELP 查看帮助");
				continue;
			}
			
			Command command = CommandFactory.buildCommand(cmdCode);
			command.execute();

		}
    }
}
